package com.anolesoft.yr.mbus.contm.entity;

import com.anolesoft.yr.mbus.cont.entity.ContContent;
import com.anolesoft.yr.mbus.contm.dto.ContmBaseClauseDto;
import com.anolesoft.yr.mbus.contm.dto.ContmContentDto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
    * 合同页内容信息表
    */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "contm_content")
public class ContmContent implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "objuid")
    private String objuid;

    /**
     * 模板主表主键
     */
    @TableField(value = "contm_main_uid")
    private String contmMainUid;

    /**
     * 页类别
     */
    @TableField(value = "page_type")
    private String pageType;

    /**
     * 类型
     */
    @TableField(value = "item_type")
    private String itemType;

    /**
     * 序号
     */
    @TableField(value = "order_code")
    private Byte orderCode;

    /**
     * 别名
     */
    @TableField(value = "`alias`")
    private String alias;

    /**
     * 父级
     */
    @TableField(value = "parent_uid")
    private String parentUid;

    /**
     * 内容
     */
    @TableField(value = "content")
    private String content;

    /**
     * 样式子表主键
     */
    @TableField(value = "style_item_uid")
    private String styleItemUid;

    @TableField(exist = false)
    private List<ContmContent> contmContents;

    private static final long serialVersionUID = 1L;


    public ContmContentDto toContmContentDto(){
        return ContmContentDto.builder().id(objuid).title(content).pId(parentUid).ppId(parentUid).name(alias).type(itemType).pageType(pageType).build();
    }

    public ContContent toContContent(String contMainUid){
        return ContContent.builder().alias(alias).content(content).itemType(itemType).pageType(pageType).orderCode(orderCode).contMainUid(contMainUid).contmStyleUid(contmMainUid).objuid(objuid).parentUid(parentUid).build();
    }

}